import { LOGIN, LOGOUT, SET_USER_INFO } from "../constant";


const initialState = {token: ''};
export default function login(preState = initialState, action) {
    const {type, data} = action;
    switch (type) {
        case LOGIN:
            return data;
        case LOGOUT:
            return {token: ''};
        case SET_USER_INFO:
            console.log('===SET_USER_INFO',data)
            return {...preState, ...data};
        default:
            return preState;
    }
}